Skip to content

fix(local-file-list-adapter): navigation#16318

Merged
alperozturk96 merged 1 commit into
masterfrom
fix/local-file-list-adapter-navigation-crash
Jan 21, 2026
Merged

fix(local-file-list-adapter): navigation#16318
alperozturk96 merged 1 commit into
masterfrom
fix/local-file-list-adapter-navigation-crash

Conversation

@alperozturk96

@alperozturk96 alperozturk96 commented Jan 19, 2026

Copy link
Copy Markdown
Collaborator
  • Tests written, or not not needed

Issue

The app crashes when the user presses back from the local directory

How to reproduce?

  1. Tap the "+" button and go to Upload files.
  2. On the upload screen, navigate to an internal folder or subfolder and scroll through the files.
  3. Tap the back button in the top-left corner without selecting any files.
  4. Repeat the steps above if the crash doesn’t occur the first time.

Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
public void swapDirectory(final File directory) {
localFileListFragmentInterface.setLoading(true);
currentOffset = 0;
mFiles.clear();

@alperozturk96 alperozturk96 Jan 19, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updateUIForFirstPage will clear it.

new Handler(Looper.getMainLooper()).post(() -> {
int from = mFiles.size();
int to = updatedList.size();
int headerOffset = shouldShowHeader() ? 1 : 0;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add shouldShowHeader into the calculation.

new Handler(Looper.getMainLooper()).post(() -> {
mFiles = new ArrayList<>(firstPage);
mFilesAll = new ArrayList<>(firstPage);
mFiles.clear();

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clear mFiles in updateUIForFirstPage.

@github-actions

Copy link
Copy Markdown

Codacy

SpotBugs

CategoryBaseNew
Bad practice4343
Correctness7474
Dodgy code257257
Experimental11
Internationalization77
Malicious code vulnerability33
Multithreaded correctness3434
Performance4444
Security1818
Total481481

@github-actions

Copy link
Copy Markdown

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/16318.apk

qrcode

To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.

@github-actions

Copy link
Copy Markdown

blue-Light-Screenshot test failed, but no output was generated. Maybe a preliminary stage failed.

@ZetaTom ZetaTom left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works perfectly after rebasing onto master.

@alperozturk96 alperozturk96 merged commit 4550009 into master Jan 21, 2026
19 of 22 checks passed
@alperozturk96 alperozturk96 deleted the fix/local-file-list-adapter-navigation-crash branch January 21, 2026 10:08
@alperozturk96

Copy link
Copy Markdown
Collaborator Author

/backport to stable-3.35

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants